﻿<ResourceDictionary xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctr='clr-namespace:NczControlLibrary.Controls'>
    <ctr:InfoContent x:Key='icc'/>
    <Style TargetType='ctr:OarButton'>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='ctr:OarButton'>
                    <Border BorderBrush='{TemplateBinding BorderBrush}' BorderThickness='{TemplateBinding BorderThickness}' CornerRadius='{TemplateBinding CornerRadius}'  x:Name='root'>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name='info'>
                                <VisualState x:Name='infoover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infodown'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.4' From='0' To='180' Storyboard.TargetName='grid' Storyboard.TargetProperty='(Grid.Projection).(PlaneProjection.RotationY)'/>
                                        <DoubleAnimation Duration='0:0:.0' To='180' Storyboard.TargetName='infotb' Storyboard.TargetProperty='(TextBlock.Projection).(PlaneProjection.RotationY)'/>
                                        <DoubleAnimation Duration='0:0:.2' BeginTime='0:0:.2' To='{Binding ElementName=rect2,Path=Width}' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.2' BeginTime='0:0:.2' To='{Binding ElementName=rect2,Path=Width}' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.3' Value='Visible'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='ContentPanel' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.1' Value='Collapsed'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='grid' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.35' Value='RightToLeft'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames FillBehavior='HoldEnd' Duration='0:0:0.401' Storyboard.TargetName='root' Storyboard.TargetProperty='BorderThickness'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:0' Value='0,0,0,0'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infoup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infoleave'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame Value='LeftToRight' KeyTime='0:0:.05'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infolpover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infolpdown'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.4' From='180' To='0' Storyboard.TargetName='grid' Storyboard.TargetProperty='(Grid.Projection).(PlaneProjection.RotationY)'/>
                                        <DoubleAnimation Duration='0:0:.2' BeginTime='0:0:.2' To='0' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.2' BeginTime='0:0:.2' To='{Binding ElementName=rect2,Path=Height}' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.1' Value='Collapsed'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='ContentPanel' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.3' Value='Visible'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames FillBehavior='Stop' Duration='0:0:0.401' Storyboard.TargetName='root' Storyboard.TargetProperty='BorderThickness'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:0' Value='0,0,0,0'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infolpup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infolpleave'>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name='infobutton'>
                                <VisualState x:Name='infobuttonover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttondown'>
                                    <Storyboard>
                                        <ColorAnimation Duration='0' To='Snow' Storyboard.TargetName='rect' Storyboard.TargetProperty='(Rectangle.Fill).(SolidColorBrush.Color)'/>
                                        <DoubleAnimation Duration='0:0:.1' To='1.5' Storyboard.TargetName='rect' Storyboard.TargetProperty='Width'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ColorAnimation Duration='0' To='Transparent' Storyboard.TargetName='rect' Storyboard.TargetProperty='(Rectangle.Fill).(SolidColorBrush.Color)'/>
                                        <DoubleAnimation Duration='0:0:.1' To='.5' Storyboard.TargetName='rect' Storyboard.TargetProperty='Width'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonleave'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame Value='LeftToRight' KeyTime='0:0:.15'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonlpover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.15' By='{Binding ElementName=rect2,Path=Width}' FillBehavior='HoldEnd' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.15' From='0' To='{Binding ElementName=rect2,Path=Width}' FillBehavior='HoldEnd' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.2' Value='RightToLeft'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:0' Value='Visible'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonlpdown'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:0' To='{Binding ElementName=rect2,Path=Hight}' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:0' To='0' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.01' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame Value='LeftToRight' KeyTime='0:0:.05'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.1' Value='Collapsed'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonlpup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='infobuttonlpleave'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name='button'>
                                <VisualState x:Name='buttonover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttondown'>
                                    <Storyboard>
                                        <ColorAnimation Duration='0' To='Snow' Storyboard.TargetName='rect' Storyboard.TargetProperty='(Rectangle.Fill).(SolidColorBrush.Color)'/>
                                        <DoubleAnimation Duration='0:0:.05' To='1.5' Storyboard.TargetName='rect' Storyboard.TargetProperty='Width'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ColorAnimation Duration='0' To='Transparent' Storyboard.TargetName='rect' Storyboard.TargetProperty='(Rectangle.Fill).(SolidColorBrush.Color)'/>
                                        <DoubleAnimation Duration='0:0:.05' To='.5' Storyboard.TargetName='rect' Storyboard.TargetProperty='Width'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonleave'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame Value='LeftToRight' KeyTime='0:0:.05'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonlpover'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.01' To='1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonlpdown'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.1' By='{Binding ElementName=rect2,Path=Width}' FillBehavior='HoldEnd' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.1' From='0' To='{Binding ElementName=rect2,Path=Width}' FillBehavior='HoldEnd' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.05' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.05' Value='RightToLeft'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.08' Value='Visible'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonlpup'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='buttonlpleave'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:0' To='{Binding ElementName=rect2,Path=Hight}' Storyboard.TargetName='grid' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:0' To='0' Storyboard.TargetName='label' Storyboard.TargetProperty='Width'/>
                                        <DoubleAnimation Duration='0:0:.01' To='0' Storyboard.TargetName='arrows' Storyboard.TargetProperty='(Path.RenderTransform).(TranslateTransform.X)'/>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='arrows' Storyboard.TargetProperty='FlowDirection'>
                                            <DiscreteObjectKeyFrame Value='LeftToRight' KeyTime='0:0:.05'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:.1' Storyboard.TargetName='label' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:.08' Value='Collapsed'/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup>
                                <VisualState x:Name='normal'/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name='grid'  HorizontalAlignment='Stretch' VerticalAlignment='Stretch' Width='{Binding Path=Width,Mode=TwoWay,RelativeSource={RelativeSource Mode=TemplatedParent}}' Height='{TemplateBinding Height}' Background='{TemplateBinding Background}' Margin='{TemplateBinding Padding}'>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width='auto'/>
                                <ColumnDefinition Width='*'/>
                                <ColumnDefinition Width='auto'/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Name='ArrowsPanel' Grid.Column='2' Orientation='Horizontal'  VerticalAlignment='Stretch' HorizontalAlignment='Right'>
                                <Rectangle x:Name='rect' VerticalAlignment='Stretch' Width='.5' Fill='Transparent'>
                                    <Rectangle.Effect>
                                        <BlurEffect Radius='6'/>
                                    </Rectangle.Effect>
                                </Rectangle>
                                <Border Background='Black' Width='24'>
                                    <Path x:Name='arrows' FlowDirection='LeftToRight' Fill='Snow' Data='m0,0l9,9 -9,9 0,-5  4,-4 -4,-4z' HorizontalAlignment='Center' VerticalAlignment='Center'>
                                        <Path.RenderTransform>
                                            <TranslateTransform/>
                                        </Path.RenderTransform>
                                    </Path>
                                </Border>
                            </StackPanel>

                            <Rectangle x:Name='rect2' Width='{TemplateBinding InfoWidth}' Height='{Binding Path=Width,Mode=OneTime,RelativeSource={RelativeSource Mode=TemplatedParent}}' Visibility='Collapsed' />
                            <StackPanel Orientation='Horizontal' x:Name='label' Grid.Column='1' Visibility='Collapsed' Background='{TemplateBinding InfoBackground}' HorizontalAlignment='Right' VerticalAlignment='Stretch'>
                                <Rectangle VerticalAlignment='Stretch' Width='.5'>
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint='0,0' EndPoint='0,1'>
                                            <GradientStopCollection>
                                                <GradientStop Offset='.1' Color='Transparent'/>
                                                <GradientStop Offset='.5' Color='Snow'/>
                                                <GradientStop Offset='.9' Color='Transparent'/>
                                            </GradientStopCollection>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Image Source='{TemplateBinding InfoPicture}' Stretch='UniformToFill'/>
                                <TextBlock x:Name='infotb' Text='{Binding Path=Info,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource icc}}' FontSize='{TemplateBinding InfoSize}' VerticalAlignment='Center' TextAlignment='Center' HorizontalAlignment='Stretch' Margin='2,0,2,0' TextWrapping='Wrap'>
                                    <TextBlock.Projection>                                        
                                        <PlaneProjection CenterOfRotationY='.5'/>
                                    </TextBlock.Projection>
                                </TextBlock>
                            </StackPanel>

                            <StackPanel Name='ContentPanel' Grid.Column='0' VerticalAlignment='Center' HorizontalAlignment='Center' Orientation='Horizontal'>
                                <Rectangle Fill='Transparent' HorizontalAlignment='Stretch' VerticalAlignment='Stretch' Width='{TemplateBinding HorizontalOffset}'/>
                                <Path Fill='{TemplateBinding Fill}' Stroke='{TemplateBinding Stroke}' StrokeThickness='{TemplateBinding StrokeThickness}' Data='{TemplateBinding Data}'/>
                                <TextBlock Text='{TemplateBinding Text}' Foreground='{TemplateBinding Foreground}' FontSize='{TemplateBinding FontSize}' FontWeight='{TemplateBinding FontWeight}' FontStyle='{TemplateBinding FontStyle}'/>
                            </StackPanel>
                            <Grid.Projection>
                                <PlaneProjection CenterOfRotationY='.5'/>
                            </Grid.Projection>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
